package com.etc.stringdemo;

/**
 * @author: knowno
 * @create: 2024-09-09 15:10
 * @Version 1.0
 **/
public class StringCompare {
    public static void main(String[] args) {

        //字面值hello
        String str1 = "hello";
        String str2 = "hello";
         // == 比较的是地址  str1和str2 地址相同
        System.out.println(str1 == str2); //true

        //非字面值 new String("hello")
        String str3 = new String("hello");
        String str4 = new String("hello");
        System.out.println(str3 == str4); //false





    }
}
